package com.ssyu.dome.common.utl;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.ssyu.dome.entity.UserEntity;

/**
 * 所有的Action继承此类
 *
 */
public class BaseAction {

    /**
     * 获取Session
     * 
     * @return
     */
    public HttpSession getSession() {
        return ServletActionContext.getRequest().getSession();
    }

    /**
     * 从Session中获取求职者信息
     */
    public UserEntity getTalent() {
        UserEntity userEntity = (UserEntity) getSession().getAttribute("userEntity");
        return userEntity;
    }

    /**
     * 从Session中获取求职者id
     */
    public int getTalentId() {
        return getTalent().getId();
    }
}
